/*
 * Copyright 2013 NJUT  qixiaobo. All rights reserved.
 */
package com.fujitsu.nanjing.tieba.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fujitsu.nanjing.tieba.base.BaseService;
import com.fujitsu.nanjing.tieba.constrant.CommonParamter;
import com.fujitsu.nanjing.tieba.ibator.CoreVisitStat;
import com.fujitsu.nanjing.tieba.ibator.CoreVisitStatCriteria;
import com.fujitsu.nanjing.tieba.model.VisitStat;

/**
 * VisitStatService.java
 * 
 * @author Administrator
 */
@Service
@Transactional
public class VisitStatService
		extends
			BaseService<CoreVisitStat, CoreVisitStatCriteria> {
	@Resource
	private VisitStat visitStat;

	@Override
	public CoreVisitStat findById(String id) {
		return visitStat.selectByPrimaryKey(id);

	}

	@Override
	public CoreVisitStat insert(CoreVisitStat t) {
		visitStat.insertSelective(t);
		return t;
	}

	@Override
	public void update(CoreVisitStat t) {
		visitStat.updateByPrimaryKeySelective(t);

	}
	@Override
	public void delete(CoreVisitStat t) {
		visitStat.deleteByPrimaryKey(t.getStatdate());

	}
	public List<CoreVisitStat> findVisitStats() {
		CoreVisitStatCriteria example = new CoreVisitStatCriteria();
		example.setMysqlLength(CommonParamter.默认分页长度);
		example.setOrderByClause("statDate desc");
		return visitStat.selectByExample(example);
	}

}
